
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>内容查找与替换</title>
    <style>
       div{float: left;}
       a:link,a:visited{
                color: #222;text-decoration: none;}
        a:hover{color: #fd4913;}
        p{line-height: 38px;font-size: 18px;}
    </style>
</head>
<body>
    <div>过滤前内容：<br>
      <textarea id="pre" cols="40" rows="10"></textarea>
      <input type="button" id="btn" value="过滤">
      <input type="button" id="bon" value="清空">
    </div>
    <div>过滤后内容：<br>
      <textarea id="res" cols="40" rows="10"></textarea>
    </div>
    <script>
        document.getElementById('bon').onclick=function(){
            document.getElementById('pre').value='';
            document.getElementById('res').value='';
        }
        document.getElementById('btn').onclick=function(){
            var reg=/[\u4e00-\u9fa5]/gi;
            var str=document.getElementById('pre').value;
            var newstr=str.replace(reg,'*');
            document.getElementById('res').value=newstr;
        };
    </script>
     <p><a href="9.html">返回上一页</a></p>

</body>
</html>